package com.ddzh.conroller;

import com.ddzh.pojo.User;
import com.ddzh.service.USerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private USerService uSerService;

    @GetMapping("{username}")
    public User findUserById(@PathVariable("username") String username) {
        //查询用户信息
        User user = uSerService.findUserById(username);
        System.out.println("user = " + user);
        return user;
    }
}

